#! /bin/bash

. ./environment

echo "---------removing old kernel--------"
rm ${SYSTEM_DIR}/boot/${KERNEL_FILE}
if [ ! -f ${KERNEL} ]
then
	echo "---------Make---------"
	make build -C ${SOURCE_DIR}
	exit=$?
	if [ $exit -ne 0 ]
	then
		echo ---------Make fails!!!---------
		exit $exit
	fi
	echo ---------Make ok--------
fi
echo --------Copying kernel--------
cp -uf ${KERNEL} ${SYSTEM_DIR}/boot
